<?php
$matches = [
    'yesterday' => [
        [
            'time' => '15:00',
            'team1' => 'Team A',
            'team2' => 'Team B',
            'team1_logo' => '/images/barcelona.png',
            'team2_logo' => '/images/barcelona.png',
            'league' => 'League 1',
            'team1_score' => 2,
            'team2_score' => 1,
        ],
        [
            'time' => '18:00',
            'team1' => 'Team C',
            'team2' => 'Team D',
            'team1_logo' => '/images/barcelona.png',
            'team2_logo' => '/images/barcelona.png',
            'league' => 'League 2',
            'team1_score' => 0,
            'team2_score' => 3,
        ],
    ],
    'today' => [
        [
            'time' => '12:00',
            'team1' => 'Team E',
            'team2' => 'Team F',
            'team1_logo' => '/images/barcelona.png',
            'team2_logo' => '/images/barcelona.png',
            'league' => 'League 3',
            'team1_score' => 1,
            'team2_score' => 1,
        ],
        [
            'time' => '20:00',
            'team1' => 'Team G',
            'team2' => 'Team H',
            'team1_logo' => '/images/barcelona.png',
            'team2_logo' => '/images/barcelona.png',
            'league' => 'League 4',
            'team1_score' => 4,
            'team2_score' => 2,
        ],
    ],
    'tomorrow' => [
        [
            'time' => '14:00',
            'team1' => 'Team I',
            'team2' => 'Team J',
            'team1_logo' => '/images/barcelona.png',
            'team2_logo' => '/images/barcelona.png',
            'league' => 'League 5',
            'team1_score' => null,
            'team2_score' => null,
        ],
        [
            'time' => '19:00',
            'team1' => 'Team K',
            'team2' => 'Team L',
            'team1_logo' => '/images/barcelona.png',
            'team2_logo' => '/images/barcelona.png',
            'league' => 'League 6',
            'team1_score' => null,
            'team2_score' => null,
        ],
    ],
];
?>



<div class="sidebar">
    <!-- <div class="matchs">
        <div class='days fx fx_jc_between fx_ai_center'>
            <button class="btn nowrap" data-date='yesterday' type="button">مباريات قادمة</button>
            <button class="btn nowrap" data-date="today" type="button">مباريات اليوم</button>
            <button class="btn nowrap" data-date="tomorrow" type="button">مباريات الأمس</button>
        </div>
        <div class="daysdata">
            <div data-name="yesterday">
                <div class="daymatchs brds pd">
                    <span class="daytime">2023-10-00</span>
                    <div class="matchs">
                        <?php foreach ($matches['yesterday'] as $match): ?>
                            <div class="match brds fx fx_jc_between fx_ai_center pd">
                                <div class="teamicon fx fxcolumn fx_ai_center gap">
                                    <div class="team-logo">
                                        <img src="<?= get_template_directory_uri() . $match['team1_logo'] ?>" alt="<?= $match['team1'] ?> logo" class="logo">
                                    </div>
                                    <span class="team"><?= $match['team1'] ?></span>
                                </div>
                                <div class="teamscore fx fx_jc_between fx_ai_center gap">
                                    <span><?= $match['team1_score'] ?></span>
                                    <div class="fx fxcolumn fx_ai_center gap">
                                        <span class="time"><?= $match['time'] ?></span>
                                        <span class="league"><?= $match['league'] ?></span>
                                    </div>
                                    <span><?= $match['team2_score'] ?> </span>
                                </div>
                                <div class="teamicon fxcolumn fx fx_ai_center gap">
                                    <div class="team-logo">
                                        <img src="<?= get_template_directory_uri() . $match['team2_logo'] ?>" alt="<?= $match['team2'] ?> logo" class="logo">
                                    </div>
                                    <span class="team"><?= $match['team2'] ?></span>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>
            <div data-name="today">
                <div class="daymatchs brds pd">
                    <span class="daytime">2023-10-01</span>
                    <div class="matchs">
                        <?php foreach ($matches['today'] as $match): ?>
                            <div class="match brds fx fx_jc_between fx_ai_center pd">
                                <div class="teamicon fx fxcolumn fx_ai_center gap">
                                    <div class="team-logo">
                                        <img src="<?= get_template_directory_uri() . $match['team1_logo'] ?>" alt="<?= $match['team1'] ?> logo" class="logo">
                                    </div>
                                    <span class="team"><?= $match['team1'] ?></span>
                                </div>
                                <div class="teamscore fx fx_jc_between fx_ai_center gap">
                                    <span><?= $match['team1_score'] ?></span>
                                    <div class="fx fxcolumn fx_ai_center gap">
                                        <span class="time"><?= $match['time'] ?></span>
                                        <span class="league"><?= $match['league'] ?></span>
                                    </div>
                                    <span><?= $match['team2_score'] ?> </span>
                                </div>
                                <div class="teamicon fxcolumn fx fx_ai_center gap">
                                    <div class="team-logo">
                                        <img src="<?= get_template_directory_uri() . $match['team2_logo'] ?>" alt="<?= $match['team2'] ?> logo" class="logo">
                                    </div>
                                    <span class="team"><?= $match['team2'] ?></span>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>

            </div>
            <div data-name="tomorrow">
                <div class="daymatchs brds pd">
                    <span class="daytime">2023-10-02</span>
                    <div class="matchs">
                        <?php foreach ($matches['tomorrow'] as $match): ?>
                            <div class="match brds fx fx_jc_between fx_ai_center pd">
                                <div class="teamicon fx fxcolumn fx_ai_center gap">
                                    <div class="team-logo">
                                        <img src="<?= get_template_directory_uri() . $match['team1_logo'] ?>" alt="<?= $match['team1'] ?> logo" class="logo">
                                    </div>
                                    <span class="team"><?= $match['team1'] ?></span>
                                </div>
                                <div class="teamscore fx fx_jc_between fx_ai_center gap">
                                    <span><?= $match['team1_score'] ?></span>
                                    <div class="fx fxcolumn fx_ai_center gap">
                                        <span class="time"><?= $match['time'] ?></span>
                                        <span class="league"><?= $match['league'] ?></span>
                                    </div>
                                    <span><?= $match['team2_score'] ?> </span>
                                </div>
                                <div class="teamicon fxcolumn fx fx_ai_center gap">
                                    <div class="team-logo">
                                        <img src="<?= get_template_directory_uri() . $match['team2_logo'] ?>" alt="<?= $match['team2'] ?> logo" class="logo">
                                    </div>
                                    <span class="team"><?= $match['team2'] ?></span>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>
        </div>
    </div> -->


    <div class="sblanmu fx fxcolumn gap">
        <span class="title litem brds bshadow"> أقسام الموقع</span>
        <ul class="fx fxcolumn gap">
            <?php
            foreach ($leafCategories  as $category) {
                if ($category->parent == 0)    echo '<li class="litem brds bshadow"><a href="' . get_category_link($category->term_id) . '">' . $category->name . '</a></li>';
            }
            ?>
        </ul>
    </div>

    <div class="sblanmu fx fxcolumn  gap">
        <span class="title litem brds bshadow"> ترند الأخبار</span>
    </div>

    <?php get_template_part('posty', null, [
            'data' => [
                'posts' => get_random_posts(5),
            ],
            'showEmpty' => false,
            'showPage' => false,
        ]); ?>

</div>